package cn.sinata.wanglin.adapter;


import android.text.TextUtils;

import com.facebook.drawee.view.SimpleDraweeView;
import com.xilada.xldutils.adapter.HFRecyclerAdapter;
import com.xilada.xldutils.adapter.util.ViewHolder;
import java.util.List;
import cn.sinata.wanglin.R;
import cn.sinata.wanglin.model.Message;
import cn.sinata.wanglin.utils.RelativeDateFormat;

public class NoticeAdapter extends HFRecyclerAdapter<Message> {
    public NoticeAdapter(List<Message> mData) {
        super(mData, R.layout.item_noticemessage_layout);
    }

    @Override
    public void onBind(int position, Message message, ViewHolder holder) {
               ((SimpleDraweeView) holder.bind(R.id.iv_noticemsg_msghead)).setImageURI(message.getNotice_img());
                if(!TextUtils.isEmpty( message.getTitle())){
                    holder.setText(R.id.tv_noticemsg_title, message.getTitle());
                }else{
                    holder.setText(R.id.tv_noticemsg_title, "暂无消息内容");
                }

            holder.setText(R.id.tv_noticemsg_time, RelativeDateFormat.getTimeYMDHMS(message.getCreate_date()));

    }
}
